﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PersonalWebSite.Models.Admin;
using PersonalWebSite.Common;

namespace PersonalWebSite.Controllers
{
    public class AdminController : BaseController
    {
        //
        // GET: /Admin/
        [Authorize]
        public ActionResult Index()
        {
            return View();
        }

        //
        // GET: /Videos/
        [Authorize]
        public ActionResult Videos()
        {
            return View();
        }

        //
        // GET: /Quotes/
        [Authorize]
        public ActionResult Quotes()
        {
            return View();
        }

        [Authorize]
        public ActionResult Links()
        {
            return View();
        }

        [Authorize, HttpPost]
        public ActionResult SaveFile(FileInfoViewModel model)
        {
            return Json(FileDataManager.SaveFileInfo(model));
        }

        [Authorize, HttpPost]
        public ActionResult LoadFile(FileInfoViewModel model)
        {
            return Json(FileDataManager.LoadFileInfo(model.FileName));
        }

        [Authorize, HttpPost]
        public ActionResult FetchUrlData(string url)
        {
            return Json(LinksManager.FetchUrlData(url));
        }

        [Authorize, HttpPost]
        public ActionResult TakeScreenShot(string url, string guid)
        {
            LinksManager.TryTakeScreenshot(url, guid);
            return Json(null);
        }

        [HttpGet]
        public ActionResult GenerateGuid()
        {
            return Json(Guid.NewGuid().ToString(), JsonRequestBehavior.AllowGet);
        }
    }
}
